/*system functions manage,it contains to update system functions
 * create by lms at 2016.03.29
 * Fuzhou Huilin corp.ltd
 * last update by lms at 2016.04.01
 * */

package com.fzrskj.cloud.free.sys.dao;

import com.fzrskj.cloud.free.core.utils.CloudDbDrvUtils;
import com.fzrskj.cloud.free.sys.bean.Func;
import ms.core.consts.SysErr;
import ms.core.db.IDbDrv;
import ms.core.object.CObject;

import java.util.List;

public class CFuncDao extends CObject {
	//private declaration
	IDbDrv db = null;

	//constructor function to initialize database
	public CFuncDao(){
		db = CloudDbDrvUtils.getDbUtilsDrv();
	}

	//dispose function implements to free resource
	@Override
	public void dispose(){
		super.dispose();
		db.closeConnection();
		db = null;
	}

	//to query system all functions
	public List<Func> queryFunc(){
		String strSql = "select * from sys_function order by funId";
		List<Func> ret = db.queryForBeans(strSql, Func.class);
		String err = db.getErrCode();
		if (!err.equals(SysErr.CODE_SUCCESS)){
			this.log(db.getMsg());
		}
		this.setErrCode(err);
		return ret;
	}
}
